{layout '../Public/layoutList.latte'} {*继承layoutList模板*}
{block title}{$title}{/block}
{block actions}
    <a href="{url("consoles_add","con=Standard&active=".$active)}" class="icon-adds" data-side-form>添加</a>
{/block}
{block actionstab}
    {include "./actionstab.latte"}
{/block}
{block private_css}
    <style type="text/css">
        .share td a{
            background:#35aa47; color:#fff; padding:5px; border-radius:20px;
        }

        .share td a:first-child{
            margin-right:300px;
            background:#14b9d9;
        }

        .share td a:hover{
            cursor:pointer;
            text-decoration:none;
        }
    </style>
{/block}
{block private_js}
    <script type="text/javascript">
        init.ready(function () {
            $(".newTr").on('click', function () {
                var that = $(this);
                if (that.attr("data-status") == "closed") {

                    that.attr("data-status", "opened")
                    that.parent().parent().next(".share").removeAttr("hidden");

                    var url = that.attr('href');
                    var eventid = that.attr('data-eventid')
                    var template = that.attr('data-template')
                    var postData = {
                        eventid: eventid,
                        template: template,
                    };
                    var index = that.parent().parent().index();
                    index++;
                    $.ajax({
                        url: url,
                        type: "POST",
                        data: postData,
                        dataType: "json",
                        success: function (res) {
                            if (res.status == "n") {
                                return;
                            } else {
                                that.parent().parent().parent().find('tr').eq(index).find('td a.copyBtn').attr('onclick', 'copy(\'' + res.url + '\')')
                            }
                        }
                    });

                } else {
                    that.attr("data-status", "closed")
                    that.parent().parent().next(".share").attr("hidden", "");
                }
                return false;
            });

        })

        function copy(message) {
            var input = document.createElement("input");
            input.value = message;
            document.body.appendChild(input);
            input.select();
            input.setSelectionRange(0, input.value.length), document.execCommand('Copy');
            document.body.removeChild(input);
            layer.msg('复制成功')
        }

    </script>
{/block}
{*选中记录的操作按钮*}
{block actions2}
    <div class="list-more-action-item" data-url="{url('consoles_delete_mul','con=Standard&active='.$active)}">删除</div>
{/block}

{block content}
    <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <thead>
        <tr>
            <th></th>
            <th data-sort="s.names"><span class="table-head">名称</span></th> {*在th加入 data-sort 可对数据库进行排序*}
            <th data-sort="s.id"><span class="table-head">类型</span></th>
            {if $active == 'All' or $types == 4}
                <th data-sort="s.workload"><span class="table-head">任务量</span></th>
            {/if}
            <th><span class="table-head">积分</span></th>
            <th data-sort="s.hot"><span class="table-head">热度</span></th>
            {*<th data-sort="s.acorn"><span class="table-head">频率</span></th>*}
            <th data-sort="s.status"><span class="table-head">状态</span></th>
            <th><span class="table-head">操作</span></th>
        </tr>
        </thead>
        <tbody>
        {foreach $lists as $k=>$item}
            <tr>
                <td style="width: 60px;"><input type="checkbox" name='ids[]' class="checkall_1 checkall-item" value="{$item['s_id']}"/></td>
                <td class="wid-auto">{$item['s_names']}</td>
                <td class="wid-auto">{$item['sc_names']}</td>
                {if $active == 'All' or $types == 4}
                    {if $item['s_workload']}
                        <td class="wid-auto">
                            {if $item['s_workloadOne'][0] !=0}{$item['s_workloadOne'][0]}天{/if}
                            {if $item['s_workloadOne'][1] !=0}{$item['s_workloadOne'][1]}小时{/if}
                            {if $item['s_workloadOne'][2] !=0}{$item['s_workloadOne'][2]}分{/if}
                        </td>
                    {else}
                        <td class="wid-auto">--</td>
                    {/if}
                {/if}
                <td class="wid-auto">
                    {if $item['s_acorn']==0}
                        <p style="color:red">不预设</p>
                    {else}
                        {$item['s_acorn']}
                    {/if}
                </td>
                <td>{$item['s_hot']}</td>
                {*<td class="wid-auto">{$item['cycleMemo']}</td>*}
                <td class="center">{$item["statusMemo"]}</td>
                <td>
                    <a href="{url('consoles_mod','con=Standard&id='.$item['s_id'])}" data-side-form>编辑</a>|
                    <a href="{url('consoles_delete','con=Standard&id='.$item['s_id'].'&active='.$active)}" data-confirm="您确定要删除该标准吗?">删除</a>|
                    {*<a class="newTr" data-status="closed" href="{url('consoles_index_share')}" data-template="APPLY_STANDARD" data-eventid="{$item['s_id']}">分享</a>*}
                    <a href="{url('consoles_index_sharePage',"share={$item['share']}")}" data-popup=",720px,600px">
                        分享
                    </a>
                </td>
            </tr>
            <tr class="share" hidden>
                <td colspan="7" style="text-align: center;">
                    <a class="dingdingBtn">分享到钉钉</a>
                    <a class="copyBtn" href="javascript:void(0)">复制链接</a>
                </td>
            </tr>
        {/foreach}
        </tbody>
    </table>
{/block}




